.class public final Lcom/burstly/lib/component/preinitialize/PreinitializeManager;
.super Ljava/lang/Object;
.source "PreinitializeManager.java"


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = "PreinitializeManager"


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 36
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/preinitialize/PreinitializeManager;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 46
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 47
    return-void
.end method

.method public static preinitializeAdaptor(Ljava/lang/String;Ljava/util/Map;)V
    .locals 9
    .parameter "factoryClassName"
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .prologue
    .local p1, initParameters:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    const/4 v7, 0x1

    const/4 v8, 0x0

    .line 57
    if-nez p0, :cond_0

    .line 58
    sget-object v4, Lcom/burstly/lib/component/preinitialize/PreinitializeManager;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v5, "PreinitializeManager"

    const-string v6, "Could not preinitialize null class name"

    new-array v7, v8, [Ljava/lang/Object;

    invoke-virtual {v4, v5, v6, v7}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 83
    :goto_0
    return-void

    .line 62
    :cond_0
    :try_start_0
    invoke-static {p0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v0

    .line 63
    .local v0, clz:Ljava/lang/Class;,"Ljava/lang/Class<Lcom/burstly/lib/feature/networks/IAdaptorFactory;>;"
    const/4 v4, 0x0

    new-array v4, v4, [Ljava/lang/Class;

    invoke-virtual {v0, v4}, Ljava/lang/Class;->getConstructor([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;

    move-result-object v1

    .line 64
    .local v1, constr:Ljava/lang/reflect/Constructor;,"Ljava/lang/reflect/Constructor<Lcom/burstly/lib/feature/networks/IAdaptorFactory;>;"
    const/4 v4, 0x1

    invoke-virtual {v1, v4}, Ljava/lang/reflect/Constructor;->setAccessible(Z)V

    .line 65
    const/4 v4, 0x0

    new-array v4, v4, [Ljava/lang/Object;

    invoke-virtual {v1, v4}, Ljava/lang/reflect/Constructor;->newInstance([Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/burstly/lib/feature/networks/IAdaptorFactory;

    .line 66
    .local v3, factory:Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    invoke-interface {v3, p1}, Lcom/burstly/lib/feature/networks/IAdaptorFactory;->initialize(Ljava/util/Map;)V

    .line 67
    invoke-static {p0, v3}, Lcom/burstly/lib/component/AdaptorFactoryCache;->cacheFactory(Ljava/lang/String;Lcom/burstly/lib/feature/networks/IAdaptorFactory;)V
    :try_end_0
    .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/ClassCastException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_2

    goto :goto_0

    .line 69
    .end local v0           #clz:Ljava/lang/Class;,"Ljava/lang/Class<Lcom/burstly/lib/feature/networks/IAdaptorFactory;>;"
    .end local v1           #constr:Ljava/lang/reflect/Constructor;,"Ljava/lang/reflect/Constructor<Lcom/burstly/lib/feature/networks/IAdaptorFactory;>;"
    .end local v3           #factory:Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    :catch_0
    move-exception v2

    .line 70
    .local v2, e:Ljava/lang/ClassNotFoundException;
    sget-object v4, Lcom/burstly/lib/component/preinitialize/PreinitializeManager;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v5, "PreinitializeManager"

    const-string v6, "Could not preinitialize {0} because this class can not be found in classpath."

    new-array v7, v7, [Ljava/lang/Object;

    aput-object p0, v7, v8

    invoke-virtual {v4, v5, v6, v7}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0

    .line 73
    .end local v2           #e:Ljava/lang/ClassNotFoundException;
    :catch_1
    move-exception v2

    .line 74
    .local v2, e:Ljava/lang/ClassCastException;
    sget-object v4, Lcom/burstly/lib/component/preinitialize/PreinitializeManager;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v5, "PreinitializeManager"

    const-string v6, "Could not preinitialize {0} because it does not implement com.burstly.lib.component.networkcomponent.IAdaptorFactory interface."

    new-array v7, v7, [Ljava/lang/Object;

    aput-object p0, v7, v8

    invoke-virtual {v4, v5, v6, v7}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0

    .line 79
    .end local v2           #e:Ljava/lang/ClassCastException;
    :catch_2
    move-exception v2

    .line 81
    .local v2, e:Ljava/lang/Exception;
    sget-object v4, Lcom/burstly/lib/component/preinitialize/PreinitializeManager;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v5, "PreinitializeManager"

    invoke-virtual {v4, v5, v2}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0
.end method
